﻿<?
include("../Comm/Manage_err.php");
include("../Comm/Conn.php");
if($_POST['add']=="yes"){
$NetsysPass=md5($_POST[NetsysCheckPass]);
 $sql="insert into Netsys_Manage (NetsysName,NetsysPass,NetsyClass) " .
  		"values ('$_POST[NetsysName]','$NetsysPass','$_POST[NetsyClass]')";
    mysql_query($sql);
     echo "<script language='javascript'>"; 
     echo "alert('管理员添加成功！');";
     echo " location='Netsys_List.php';"; 
     echo "</script>";
}
else{
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Netsys网站管理系统</title>
<link href="../Style/Css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
function  Check()
{
  if (form.NetsysName.value=="")
  {
		alert ("用户名不能为空")
		form.NetsysName.focus();
		return false;
  }
	if ((form.NetsysName.value.length<4)||(form.NetsysName.value.length>20))
	  {
		alert("用户名要在4-20个字符之间!")
		form.NetsysName.focus();;
		return false;
	   }
	if (form.NetsysPass.value== "") 
	{
		alert("请设置您的登录密码！");
		form.NetsysPass.focus();
		return (false);
	}
	if ((form.NetsysPass.value.length < 4)||(form.NetsysPass.value.length > 20))
	 {
		alert("登录密码必须为4~20个字符!");
		form.NetsysPass.focus();
		return (false);
	}
	if (form.NetsysCheckPass.value == "")
	 {
		alert("请核对你输入的确认密码！");
		form.NetsysCheckPass.focus();
		return (false);
	}
	if (form.NetsysPass.value != form.NetsysCheckPass.value) 
	{
		alert("登陆密码与确认密码不一致，请核对！");
		form.NetsysCheckPass.focus();
		return (false);
	} 
}
</script>
</head>
<body>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10"></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="right_tittle">
  <tr>
    <td width="3"><img src="../images/r1.jpg" width="10" height="33" /></td>
    <td><img src="../images/current.jpg" width="9" height="9" /> 当前位置 &gt;&gt; 网站管理员 | 新增管理员</td>
    <td width="10" align="right"><img src="../images/r3.jpg" width="10" height="33" /></td>
  </tr>
</table>
  <table width="98%" border="0" align="center" cellpadding="0" cellspacing="2" class="right_con">
    <tr>
      <td height="490" align="center" valign="top" bgcolor="#FFFFFF">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="5"></td>
        </tr>
      </table>
      <br />
        <form name="form" method="post" action="" onSubmit="return Check()">
          <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CDD8DF" class="table_all" >
            <tr>
              <td width="19%" align="left" class="Left_td">用户名：</td>
              <td width="81%" align="left" class="Right_td"><input name="NetsysName" type="text" id="NetsysName" style="width:300px" value="">
                  <font color="#ff0000">*</font> </td>
            </tr>
            <tr>
              <td align="left" class="Left_td">角色权限：</td>
              <td align="left" class="Right_td"><font color="#ff0000">
<select name="NetsyClass" id="NetsyClass">
  <option value="管理员">管理员</option>
  <option value="员工">员工</option>
</select>              
*</font></td>
            </tr>
            <tr>
              <td align="left" class="Left_td">登录密码：</td>
              <td align="left" class="Right_td"><input name="NetsysPass" type="text" id="NetsysPass" style="width:300px" value="">
                  <font color="#ff0000">*</font></td>
            </tr>
            <tr>
              <td align="left" class="Left_td">确认密码</td>
              <td align="left" class="Right_td"><input name="NetsysCheckPass" type="text" id="NetsysCheckPass" style="width:300px" value="">
                  <font color="#ff0000">*</font></td>
            </tr>
            <tr>
              <td align="left" class="Left_td">&nbsp;</td>
              <td align="left" class="Right_td"><input type="hidden" name="add" value="yes">
                  <input type="submit" name="Submit422" value=" 确定提交 ">
                  <input type="reset" name="Submit4222" value=" 重置信息 ">              </td>
            </tr>
          </table>
        </form>      </td>
    </tr>
</table>
</body>
</html>
<?
}
?>